package com.woniu.bh.backstage.controller;

import com.woniu.bh.backstage.param.QueryCouponParam;
import com.woniu.bh.backstage.service.ICouponService;
import com.woniu.bh.common.core.dto.ResultDto;
import com.woniu.bh.common.core.exception.ProjectExceptionResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version: V1.0
 * @author: Xbao
 * @className: CouponController
 * @packageName: com.woniu.bh.backstage.controller
 * @description:
 * @data: 2020-10-19 23:06
 */
@RestController
@RequestMapping("coupon")
@Slf4j
@Api(tags = "优惠券管理")
public class CouponController {

    @Autowired
    private ICouponService couponService;

    @GetMapping("conditionedquery")
    @ApiOperation(value = "条件查询优惠券")
    public ResultDto backconditionedquery(QueryCouponParam queryCouponParam){
        try{
            return couponService.selectPage(queryCouponParam);
        }catch (Exception e){
            e.printStackTrace();
            return ResultDto.fail(ProjectExceptionResult.SYSTEM_ERROR);
        }
    }

}
